home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / osrc.arc / ICMP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-17  |  2.3 KB  |  85 lines

  1. #ifndef    ECHO_REPLY
  2.  
  3. #include "global.h"
  4.  
  5. /* Internet Control Message Protocol */
  6.  
  7. /* Message types */
  8. #define    ECHO_REPLY    0    /* Echo Reply */
  9. #define    DEST_UNREACH    3    /* Destination Unreachable */
  10. #define    QUENCH        4    /* Source Quench */
  11. #define    REDIRECT    5    /* Redirect */
  12. #define    ECHO        8    /* Echo Request */
  13. #define    TIME_EXCEED    11    /* Time-to-live Exceeded */
  14. #define    PARAM_PROB    12    /* Parameter Problem */
  15. #define    TIMESTAMP    13    /* Timestamp */
  16. #define    TIME_REPLY    14    /* Timestamp Reply */
  17. #define    INFO_RQST    15    /* Information Request */
  18. #define    INFO_REPLY    16    /* Information Reply */
  19.  
  20. /* Internal format of an ICMP header (checksum is missing) */
  21. struct icmp {
  22.     char type;
  23.     char code;
  24.      union icmp_args {
  25.         int32 unused;
  26.         unsigned char pointer;
  27.         int32 address;
  28.         struct {
  29.             int16 id;
  30.             int16 seq;
  31.         } echo;
  32.     } args;
  33. };
  34. #define    ICMPLEN        8    /* Length of ICMP header on the net */
  35. #define    NULLICMP    (union icmp_args *)0
  36.     
  37. /* Destination Unreachable codes */
  38. #define    NET_UNREACH    0    /* Net unreachable */
  39. #define    HOST_UNREACH    1    /* Host unreachable */
  40. #define    PROT_UNREACH    2    /* Protocol unreachable */
  41. #define    PORT_UNREACH    3    /* Port unreachable */
  42. #define    FRAG_NEEDED    4    /* Fragmentation needed and DF set */
  43. #define    ROUTE_FAIL    5    /* Source route failed */
  44.  
  45. /* Time Exceeded codes */
  46. #define    TTL_EXCEED    0    /* Time-to-live exceeded */
  47. #define    FRAG_EXCEED    1    /* Fragment reassembly time exceeded */
  48.  
  49. /* Redirect message codes */
  50. #define    REDR_NET    0    /* Redirect for the network */
  51. #define    REDR_HOST    1    /* Redirect for the host */
  52. #define    REDR_TOS    2    /* Redirect for Type of Service, or-ed with prev */
  53.  
  54. struct icmp_errors {
  55.     unsigned checksum;        /* ICMP Checksum errors */
  56.     unsigned nospace;        /* alloc_mbuf failed someplace */
  57.     unsigned noloop;        /* No ICMP in response to an ICMP */
  58.     unsigned bdcsts;        /* Ignore broadcast ICMPs */
  59. };
  60. #define    ICMP_TYPES    17
  61. struct icmp_stats {
  62.     unsigned input[ICMP_TYPES];    /* ICMP input stats by type */
  63.     unsigned output[ICMP_TYPES];    /* ICMP output stats by type */
  64. };
  65.  
  66. struct ping {
  67.     struct proc *proc;
  68.     struct session *sp;
  69.     int32 sent;
  70.     int32 srtt;
  71.     int32 mdev;
  72.     int32 responses;
  73.     int16 interval;
  74.     int16 len;
  75. };
  76.  
  77. void icmp_dump();
  78.  
  79. /* ICMP messages, decoded */
  80. extern char *Icmptypes[],*Unreach[],*Exceed[],*Redirect[];
  81.  
  82. #endif    /* ECHO_REPLY */
  83.  
  84.  
  85.